//程序入口
window.main = function ($) {
  $("#root").html("Hello World !");

  function getResult(num) {
    var def = $.Deferred();
    if (num > 2) {
      def.resolve({ bigger: true });
    } else {
      def.reject({ error: true });
    }
    return def.promise();
  }

  getResult(3)
    .done(function (reqResult) {
      console.log(reqResult);
    })
    .fail(function (reqResult) {
      console.log(reqResult);
    });

  getResult(1)
    .done(function (reqResult) {
      console.log(reqResult);
    })
    .fail(function (reqResult) {
      console.log(reqResult);
    });
};
